import 'package:chop/Model/address_entity.dart';
import 'package:flutter/material.dart';

import 'TextSizeWidget.dart';

// 订单地址组件
Widget getAddress(
    AdrEntityData item, {
      String iconText,
      TextStyle iconTextStyle,
      Color iconBgColor,
      VoidCallback callback
    }) {
//  if(item == null){
//
//  }
  return GestureDetector(
    child: Row(
      children: <Widget>[
        Expanded(
          flex: 1,
          child: Center(
            child: Container(
              decoration: BoxDecoration(
                  borderRadius: BorderRadius.circular(25), color: iconBgColor),
              child: FixedSizeText(
                iconText ?? '送',
                style: iconTextStyle,
                textAlign: TextAlign.center,
              ),
              width: 25,
              height: 25,
            ),
          ),
        ),
        // icon
        Expanded(
          flex: 8,
          child: Column(
            children: <Widget>[
              Container(
                padding: EdgeInsets.only(left: 10, bottom: 2),
                alignment: Alignment.topLeft,
                child: FixedSizeText(
                  "${item.remark ?? "选择地址"}",
                  textAlign: TextAlign.left,
                  style: TextStyle(fontSize: 16),
                ),
              ),
              Container(
                padding: EdgeInsets.only(left: 10, bottom: 2),
                alignment: Alignment.topLeft,
                child: FixedSizeText(
                  "${item.name ??''}   ${item.phone??''}",
                  textAlign: TextAlign.left,
                  style: TextStyle(
                    fontSize: 13,
                  ),
                  maxLines: null,
                ),
              ),
            ],
          ),
        ),
        Expanded(
          flex: 1,
          child: Container(
            alignment: Alignment.topRight,
            child: Icon(
              Icons.chevron_right,
              color: Colors.black26,
            ),
          ),
        )
      ],
    ),
    onTap: callback,
  );
}